﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="poll-new.aspx.cs" Inherits="EnmineKaitlin.admin.poll_new" MasterPageFile="~/MasterPage/AdminDefault.Master" %>
<asp:Content ID="ctnpollnew" ContentPlaceHolderID="cphContent" runat="server">    
    <div class="form list">                
        <h2><span class="icon"><img src="../images/admin/Play.png"></span><asp:Label ID="lblFunction" runat="server"></asp:Label></h2>
        <div class="content">
            <asp:Label ID="lblNotice" runat="server" CssClass="error"></asp:Label>
            <asp:Panel ID="pnlAddPoll" runat="server">            
                <div class="form-left left">                    
                    <p class="label">Tiêu đề:</p>
                    <p class="input"><asp:TextBox ID="txtTitle" runat="server" Width="695" CssClass="txt required"></asp:TextBox></p>                     
                    <p class="label">Mô tả:</p>
                    <p class="input"><asp:TextBox ID="txtExcerpt" TextMode="MultiLine" Rows="5" Height="80" runat="server" Width="695" CssClass="txt"></asp:TextBox></p>                                                                 
                    <p class="label">Lựa chọn:</p>
                    <input type="hidden" id="hdfNumberOption" name="hdfNumberOption" value="0" />                    
                    <div id="Options"></div>
                    <p class="input">
                        <input type="text" id="txtOption" style="width:585px;" class="txt" />
                        <input type="button" class="link-btn" id="btnAddOption" value="Thêm lựa chọn" />
                    </p>
                </div>
                <div class="form-right right">
                    <div class="form-right-box">
                        <h2>Cập nhật</h2>
                        <div class="box-content">
                            <table border="0">
                                <tr>
                                    <td>Ngôn ngữ:</td>
                                    <td>
                                        <asp:DropDownList ID="ddlLanguage" runat="server">
                                            <asp:ListItem Text="Tiếng Việt" Value="vn"></asp:ListItem>
                                            <asp:ListItem Text="English" Value="en"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Ngày bắt đầu:</td>
                                    <td><asp:TextBox ID="txtStartDate" runat="server" Width="140" CssClass="txt datepicker required"></asp:TextBox></td>
                                </tr>
                                <tr>                                                                
                                    <td>Ngày kết thúc:</td>
                                    <td><asp:TextBox ID="txtEndDate" runat="server" Width="140" CssClass="txt datepicker required"></asp:TextBox></td>
                                </tr>
                                <tr><td colspan="2"><asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtStartDate" ControlToValidate="txtEndDate" Operator="GreaterThanEqual" ErrorMessage="Thời gian kết thúc phải lớn hơn thời gian bắt đầu !" Width="250"></asp:CompareValidator></td></tr>
                            </table>                                                
                            <p>                                
                                <asp:Button ID="btnAdd" Text="Đăng bài viết" runat="server" CssClass="btn" CommandName="Add" CommandArgument='publish' OnCommand="btnAdd_Click" />
                                <asp:Button ID="btnSave" Text="Lưu" runat="server" CssClass="btn" CommandName="Add" CommandArgument="draft" OnCommand="btnAdd_Click" />
                            </p>
                        </div>
                    </div>                                        
                </div>
            </asp:Panel>
            <asp:Repeater ID="rptDetailPoll" runat="server" OnItemCommand="btnAdd_Click">
                <ItemTemplate>
                    <div class="form-left left">                    
                        <p class="label">Tiêu đề:</p>
                        <p class="input"><asp:TextBox ID="txtTitle" Text='<%#Eval("PollTitle") %>' runat="server" Width="695" CssClass="txt required"></asp:TextBox></p>                     
                        <p class="label">Mô tả:</p>
                        <p class="input"><asp:TextBox ID="txtExcerpt" Text='<%#Eval("Description") %>' TextMode="MultiLine" Rows="5" Height="80" runat="server" Width="695" CssClass="txt"></asp:TextBox></p>                                                                 
                        <p class="label">Lựa chọn:</p>                                            
                        <div id="Options">
                            <input type="hidden" value='<%#Eval("PollID") %>' id="hdfPollID" />
                            <asp:Repeater ID="rptListOption" runat="server" DataSource='<%#list_option(int.Parse(Eval("PollID").ToString())) %>'>
                                <ItemTemplate>
                                    <p style="overflow: hidden;" id='p<%#Eval("OptionID") %>'><input type="hidden" value="Bị làm giá" name='hdfOption' id='hdfOption<%#Eval("OptionID") %>'><span style="float: left;">•&nbsp;&nbsp;<%#Eval("OptionName") %>&nbsp;&nbsp;&nbsp;</span><a title="Xóa" href="#" id='<%#Eval("OptionID") %>' class="deleteoptionajax btnDelete">Xóa</a></p>
                                </ItemTemplate>
                            </asp:Repeater>                                                                                    
                        </div>
                        <p class="input">
                            <input type="text" id="txtOptionName" style="width:585px;" class="txt" />
                            <input type="button" class="link-btn" id="btnAddOptionAjax" value="Thêm lựa chọn" />
                        </p>
                        <input type="hidden" class="hdfurl" id="hdfHost" runat="server" value='<%#domain %>' />
                    </div>
                    <div class="form-right right">
                        <div class="form-right-box">
                            <h2>Cập nhật</h2>
                            <div class="box-content">
                                <table border="0">
                                    <tr>
                                        <td>Ngôn ngữ:</td>
                                        <td>
                                            <asp:DropDownList ID="ddlLanguage" runat="server" SelectedValue='<%#Eval("LangID") %>'>
                                                <asp:ListItem Text="Tiếng Việt" Value="vn"></asp:ListItem>
                                                <asp:ListItem Text="English" Value="en"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>                                    
                                    </tr>
                                    <tr>
                                        <td>Ngày bắt đầu:</td>
                                        <td><asp:TextBox ID="txtStartDate" Text='<%#DisplayDateTime(Eval("StartDate").ToString()) %>' runat="server" Width="140" CssClass="txt datepicker required"></asp:TextBox></td>
                                    </tr>
                                    <tr>                                                                
                                        <td>Ngày kết thúc:</td>
                                        <td><asp:TextBox ID="txtEndDate" Text='<%#DisplayDateTime(Eval("EndDate").ToString()) %>' runat="server" Width="140" CssClass="txt datepicker required"></asp:TextBox></td>
                                    </tr>
                                    <tr>                                                                
                                        <td>Trạng thái:</td>
                                        <td>
                                            <asp:DropDownList ID="ddlStatus" runat="server" SelectedValue='<%#Eval("Status") %>'>
                                                <asp:ListItem Text="Xuất bản" Value="publish"></asp:ListItem>
                                                <asp:ListItem Text="Bản nháp" Value="draft"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                </table>                                                
                                <p>                                
                                    <asp:Button ID="btnAdd" Text="Cập nhật" runat="server" CssClass="btn" CommandName="Update" CommandArgument='publish' OnCommand="btnAdd_Click" />                                    
                                </p>
                            </div>
                        </div>                                        
                    </div>
                </ItemTemplate>
            </asp:Repeater>                            
        </div>
    </div>                    
</asp:Content>